package com.xhui.vimarket.manager.composer;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.util.ConventionWires;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Messagebox;

import com.xhui.vimarket.common.utils.springplus.ApplicationContextUtil;
import com.xhui.vimarket.manager.bean.XhuiTestBean;

public class xhuiTestComposer extends GenericForwardComposer {
    private              XhuiTestBean                          bean        =       new  XhuiTestBean();

    @Override
    public void doAfterCompose(Component comp) throws Exception {
        super.doAfterCompose(comp);
        ConventionWires.wireVariables(comp, bean);
        self.addForward("onOkNotify", self, "onDataChange");
    }
    
    public void onAdd() {
    	/**
		ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:conf/applicationContext*.xml");
		System.out.print(ctx.containsBean("dao"));
		HibernateDaoSupport templet = (HibernateDaoSupport) ctx.getBean("dao");
    	 */
    	ApplicationContext context = new ClassPathXmlApplicationContext("conf/applicationContext-commons.xml");
    	CommonsDbcpNativeJdbcExtractor rr = ApplicationContextUtil.getBean("nativeJdbcExtractor");

        Messagebox.show("你好,成功", "提示信息", Messagebox.OK, Messagebox.INFORMATION);

    }
    
    public void onEdit() {
        Messagebox.show("你好这个是修改按钮", "提示信息", Messagebox.OK, Messagebox.INFORMATION);
    }
    
    public void onDel() {
        Messagebox.show("你好这里是删除按钮", "提示信息", Messagebox.OK, Messagebox.INFORMATION);
    }
}
